import numpy as np
import time
from pymilvus import Collection, connections, utility

host = '172.24.190.60'
connections.connect('default', host=host, port='19530')
utility.list_collections()
collection_name = 'hq_random_test'
topk = 16384

c = Collection(collection_name)
search_params = {
    "metric_type": "IP",
    "params": {'ef': 32768}
}
start = time.time()
result = c.search([np.random.rand(1, 2048)[0].tolist()], "embeddings", search_params, limit=topk,
                  output_fields=['image_path'])
end = time.time()
print('{:.4f} s'.format(end - start))


